package cloudspace.vm.javassist.tests;

import java.lang.reflect.InvocationTargetException;


public class JavaIOTest extends JavassistTestCase
{
    String classToLoad = "_test.wrap.JavaIOTestClass";


    public void setUp()
    {
        super.setUp();
    }


    public void testSuperConstructor()
    {
        try
        {
            String methodToTest = "superFileReaderConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            e.printStackTrace();
            assertTrue( false );
        }
    }


    public void testConstructorString()
    {
        try
        {
            String methodToTest = "fileReaderConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            e.printStackTrace();
            assertTrue( false );
        }
    }


    public void testSuperFileInputString()
    {
        try
        {
            String methodToTest = "superFileInputConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            e.printStackTrace();
            assertTrue( false );
        }
    }


    public void testFileInputString()
    {
        try
        {
            String methodToTest = "fileInputConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            e.printStackTrace();
            assertTrue( false );
        }
    }


    public void testConstructorFileOutputStringSuper()
    {
        try
        {
            String methodToTest = "superFileOutputConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testConstructorFileOutputString()
    {
        try
        {
            String methodToTest = "fileOutputConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testConstructorFileOutputStringBooleanSuper()
    {
        try
        {
            String methodToTest = "superFileOutputConstructorStringBoolean";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            e.printStackTrace();
            assertTrue( false );
        }
    }


    public void testConstructorFileOutputStringBoolean()
    {
        try
        {
            String methodToTest = "fileOutputConstructorStringBoolean";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testConstructorFilePermissionsStringString()
    {
        try
        {
            String methodToTest = "filePermissionConstructorStringString";
            String path = "C:/../testFile";
            String action = "read";
            runMethod( classToLoad, methodToTest, new Class<?>[] {
                java.lang.String.class, java.lang.String.class }, new Object[] {
                path, action } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testFileWritterConstructorStringBoolean()
    {
        try
        {
            String methodToTest = "fileWritterConstructorStringBoolean";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testSuperFileWritterConstructorStringBoolean()
    {
        try
        {
            String methodToTest = "superFileWriterConstructorStringBoolean";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testFileWritterConstructorString()
    {
        try
        {
            String methodToTest = "fileWritterConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testSuperFileWritterConstructorString()
    {
        try
        {
            String methodToTest = "superFileWriterConstructorString";
            String path = "C:/../testFile";
            runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testConstructorRandomAccessFileStringString()
    {
        try
        {
            String methodToTest = "randomAccessConstStringString";
            String path = "C:/../testFile";
            String action = "r";
            runMethod( classToLoad, methodToTest, new Class<?>[] {
                java.lang.String.class, java.lang.String.class }, new Object[] {
                path, action } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testSuperConstructorRandomAccessFileStringString()
    {
        try
        {
            String methodToTest = "superRandomAccessConstStringString";
            String path = "C:/../testFile";
            String action = "r";
            runMethod( classToLoad, methodToTest, new Class<?>[] {
                java.lang.String.class, java.lang.String.class }, new Object[] {
                path, action } );

            assertTrue( true );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }


    public void testSystemProperty()
    {
        try
        {
            String methodToTest = "systemProperty";
            String path = "user.dir";
            String systemProp = (String)runMethod( classToLoad,
                methodToTest,
                new Class<?>[] { java.lang.String.class },
                new Object[] { path } );

            assertEquals( "/", systemProp );
        }
        catch ( InvocationTargetException e )
        {
            assertTrue( false );
        }
    }
}
